﻿using System;
using System.Collections.Generic;
using Character;
using Studio;
using UnityEngine;
using Utility;

namespace Manager
{
	// Token: 0x020004D5 RID: 1237
	public class Character : Singleton<Character>
	{
		// Token: 0x06001F77 RID: 8055 RVA: 0x000C3924 File Offset: 0x000C1B24
		public ChaControl CreateFemale(GameObject _parent, int _id, CustomParameter _param = null, CharFileStatus _status = null)
		{
			Female female = ResourceUtility.CreateInstance<Female>("FemaleBody");
			if (_param != null)
			{
				female.Load(_param, false);
			}
			female.transform.SetParent(_parent.transform, false);
			ChaControl chaControl = new ChaControl(female, _status);
			this.dicChara.Add(chaControl, female);
			return chaControl;
		}

		// Token: 0x06001F78 RID: 8056 RVA: 0x000C3974 File Offset: 0x000C1B74
		public ChaControl CreateMale(GameObject _parent, int _id, CustomParameter _param = null, CharFileStatus _status = null)
		{
			Male male = ResourceUtility.CreateInstance<Male>("MaleBody");
			male.Load((_param == null) ? new CustomParameter(SEX.MALE) : _param, false);
			male.transform.SetParent(_parent.transform, false);
			ChaControl chaControl = new ChaControl(male, _status);
			this.dicChara.Add(chaControl, male);
			return chaControl;
		}

		// Token: 0x06001F79 RID: 8057 RVA: 0x000C39D0 File Offset: 0x000C1BD0
		public void DeleteChara(ChaControl _ctrl)
		{
			Human human = null;
			if (this.dicChara.TryGetValue(_ctrl, out human))
			{
				UnityEngine.Object.DestroyImmediate(human.gameObject);
			}
			this.dicChara.Remove(_ctrl);
		}

		// Token: 0x06001F7A RID: 8058 RVA: 0x000C3A0C File Offset: 0x000C1C0C
		public void DeleteCharaAll()
		{
			foreach (KeyValuePair<ChaControl, Human> keyValuePair in this.dicChara)
			{
				UnityEngine.Object.DestroyImmediate(keyValuePair.Value.gameObject);
			}
			this.dicChara.Clear();
		}

		// Token: 0x06001F7B RID: 8059 RVA: 0x000C3A80 File Offset: 0x000C1C80
		protected override void Awake()
		{
			if (!base.CheckInstance())
			{
				return;
			}
			UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
			this._Color = Shader.PropertyToID("_Color");
			this._SpecColor = Shader.PropertyToID("_SpecColor");
			this._Metallic = Shader.PropertyToID("_Metallic");
			this._Smoothness = Shader.PropertyToID("_Smoothness");
			this._Color_3 = Shader.PropertyToID("_Color_3");
			this._SpecColor_3 = Shader.PropertyToID("_SpecColor_3");
			this.dicChara = new Dictionary<ChaControl, Human>();
		}

		// Token: 0x0400212E RID: 8494
		public int _Color;

		// Token: 0x0400212F RID: 8495
		public int _SpecColor;

		// Token: 0x04002130 RID: 8496
		public int _Metallic;

		// Token: 0x04002131 RID: 8497
		public int _Smoothness;

		// Token: 0x04002132 RID: 8498
		public int _Color_3;

		// Token: 0x04002133 RID: 8499
		public int _SpecColor_3;

		// Token: 0x04002134 RID: 8500
		private Dictionary<ChaControl, Human> dicChara;
	}
}
